﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using System.Windows.Media;
using System.Windows.Media.Imaging;

namespace Conqueror.WP
{
    public partial class MapInspectorPage : PhoneApplicationPage
    {
        public MapInspectorPage()
        {
            InitializeComponent();
        }

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            LoadMap();
        }

        private async void LoadMap()
        {
            API.Map map = (await API.Map.GetMapAsync(NavigationContext.QueryString["map"])).First();
            title.Text = map.Title;
            web.Source = new BitmapImage(new Uri(map.LargeImage));
            territories.Text = map.Territories.ToString();
        }
    }
}